export function dateUtil(date, dateSeparator = '-') {
  const year = date.getFullYear()
  const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
  const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  return year + dateSeparator + month + dateSeparator + day
}

export function dateTimeFormat(dateTime, dateSeparator = '-', timeSeparator = ':') {
  const date = dateUtil(dateTime, dateSeparator)
  const hour = dateTime.getHours() < 10 ? '0' + dateTime.getHours() : dateTime.getHours()
  const minute = dateTime.getMinutes() < 10 ? '0' + dateTime.getMinutes() : dateTime.getMinutes()
  const second = dateTime.getSeconds() < 10 ? '0' + dateTime.getSeconds() : dateTime.getSeconds()
  return date + ' ' + hour + timeSeparator + minute + timeSeparator + second
}

export function currentYearMonth(date, dateSeparator = '-') {
  const year = date.getFullYear()
  const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
  return year + dateSeparator + month
}

